package com.hex.ds.hdtp.core.app.script.transfer.converter;

import com.hex.ds.hdtp.core.app.script.transfer.dto.request.ScriptConvertOptLogRequestDto;
import com.hex.ds.hdtp.core.app.script.transfer.dto.request.ScriptConvertTargetListRequestDto;
import com.hex.ds.hdtp.core.app.script.transfer.dto.response.ScriptConvertOptLogResponseDto;
import com.hex.ds.hdtp.core.inf.script.transfer.po.ScriptConvertOptLogPo;
import com.hex.ds.hdtp.core.inf.script.transfer.po.ScriptConvertTargetListPo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;


/**
 * @Package com.hex.ds.hdtp.core.app.transfer.script.converter
 * @ClassName IScriptConvertListHisConverter
 * @Description 脚本转换清单历史DTO对象与PO对象转换器
 * @Author Guo jiajun
 * @Date 2023/5/15 15:48
 * @Version v1.0
 **/
@Mapper(componentModel = "spring")
public interface IScriptConvertOptLogConverter {

    ScriptConvertOptLogPo toScriptConvertListHisPo(ScriptConvertOptLogRequestDto scriptConvertOptLogRequestDto);

    ScriptConvertOptLogResponseDto toScriptConvertListHisResponseDto(ScriptConvertOptLogPo scriptConvertOptLogPo);

    List<ScriptConvertOptLogResponseDto> toScriptConvertListHisResponseDtoList(List<ScriptConvertOptLogPo> scriptConvertListHisPoList);

    @Mapping(target = "pkId", ignore = true)
    @Mapping(target = "scriptConvertListId", source = "scriptConvertTargetList.pkId")
    @Mapping(target = "fileName", source = "scriptConvertTargetList.convertFileName")
    @Mapping(target = "sourceFilePath", source = "backUpPath")
    @Mapping(target = "modifyFilePath", source = "scriptConvertTargetList.convertFileAbsolutePath")
    ScriptConvertOptLogRequestDto toScriptConvertOptLogRequestDto(ScriptConvertTargetListRequestDto scriptConvertTargetList, String backUpPath);

}
